home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 March / PCWMAR09.iso / Software / Freeware / Adobe Media Player 1.6 / adobe_media_player.air / AMP.swf / scripts / mx / controls / ButtonBar.as < prev    next >
Encoding:
Text File  |  2008-11-25  |  22.6 KB  |  692 lines

  1. package mx.controls
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.events.Event;
  5.    import flash.events.EventPhase;
  6.    import flash.events.KeyboardEvent;
  7.    import flash.events.MouseEvent;
  8.    import flash.ui.Keyboard;
  9.    import mx.containers.BoxDirection;
  10.    import mx.controls.buttonBarClasses.ButtonBarButton;
  11.    import mx.core.ClassFactory;
  12.    import mx.core.EdgeMetrics;
  13.    import mx.core.IFlexDisplayObject;
  14.    import mx.core.IUIComponent;
  15.    import mx.core.mx_internal;
  16.    import mx.events.ChildExistenceChangedEvent;
  17.    import mx.managers.IFocusManagerComponent;
  18.    import mx.styles.CSSStyleDeclaration;
  19.    import mx.styles.StyleManager;
  20.    
  21.    use namespace mx_internal;
  22.    
  23.    public class ButtonBar extends NavBar implements IFocusManagerComponent
  24.    {
  25.       mx_internal static const VERSION:String = "3.2.0.3958";
  26.       
  27.       mx_internal var simulatedClickTriggerEvent:Event = null;
  28.       
  29.       mx_internal var focusedIndex:int = 0;
  30.       
  31.       private var directionChanged:Boolean = false;
  32.       
  33.       mx_internal var buttonWidthProp:String = "buttonWidth";
  34.       
  35.       private var oldUnscaledHeight:Number;
  36.       
  37.       mx_internal var buttonStyleNameProp:String = "buttonStyleName";
  38.       
  39.       mx_internal var lastButtonStyleNameProp:String = "lastButtonStyleName";
  40.       
  41.       private var recalcButtonWidths:Boolean = false;
  42.       
  43.       private var oldUnscaledWidth:Number;
  44.       
  45.       private var recalcButtonHeights:Boolean = false;
  46.       
  47.       mx_internal var buttonHeightProp:String = "buttonHeight";
  48.       
  49.       mx_internal var firstButtonStyleNameProp:String = "firstButtonStyleName";
  50.       
  51.       public function ButtonBar()
  52.       {
  53.          super();
  54.          tabEnabled = true;
  55.          mx_internal::navItemFactory = new ClassFactory(ButtonBarButton);
  56.          addEventListener("scaleXChanged",scaleChangedHandler);
  57.          addEventListener("scaleYChanged",scaleChangedHandler);
  58.          addEventListener(ChildExistenceChangedEvent.CHILD_REMOVE,childRemoveHandler);
  59.       }
  60.       
  61.       override public function get borderMetrics() : EdgeMetrics
  62.       {
  63.          return EdgeMetrics.EMPTY;
  64.       }
  65.       
  66.       override protected function keyUpHandler(param1:KeyboardEvent) : void
  67.       {
  68.          var _loc2_:Button = null;
  69.          if(param1.eventPhase != EventPhase.AT_TARGET)
  70.          {
  71.             return;
  72.          }
  73.          switch(param1.keyCode)
  74.          {
  75.             case Keyboard.SPACE:
  76.                if(mx_internal::focusedIndex != -1)
  77.                {
  78.                   _loc2_ = Button(getChildAt(mx_internal::focusedIndex));
  79.                   _loc2_.dispatchEvent(param1);
  80.                }
  81.                param1.stopPropagation();
  82.          }
  83.       }
  84.       
  85.       mx_internal function nextIndex(param1:int) : int
  86.       {
  87.          var _loc2_:int = numChildren;
  88.          if(_loc2_ == 0)
  89.          {
  90.             return -1;
  91.          }
  92.          return param1 == _loc2_ - 1 ? 0 : param1 + 1;
  93.       }
  94.       
  95.       private function calcFullWidth() : Number
  96.       {
  97.          var _loc6_:Number = NaN;
  98.          var _loc8_:Number = NaN;
  99.          var _loc1_:int = numChildren;
  100.          var _loc2_:Number = 0;
  101.          if(_loc1_ == 0)
  102.          {
  103.             return 0;
  104.          }
  105.          if(_loc1_ > 1)
  106.          {
  107.             _loc2_ = getStyle("horizontalGap");
  108.          }
  109.          var _loc3_:* = direction == BoxDirection.HORIZONTAL;
  110.          var _loc4_:Number = getStyle(mx_internal::buttonWidthProp);
  111.          var _loc5_:IUIComponent = IUIComponent(getChildAt(0));
  112.          if(_loc4_)
  113.          {
  114.             _loc6_ = isNaN(_loc5_.explicitWidth) ? _loc4_ : Number(_loc5_.explicitWidth);
  115.          }
  116.          else
  117.          {
  118.             _loc6_ = Number(_loc5_.getExplicitOrMeasuredWidth());
  119.          }
  120.          var _loc7_:int = 1;
  121.          while(_loc7_ < _loc1_)
  122.          {
  123.             _loc5_ = IUIComponent(getChildAt(_loc7_));
  124.             if(_loc4_)
  125.             {
  126.                _loc8_ = isNaN(_loc5_.explicitWidth) ? _loc4_ : Number(_loc5_.explicitWidth);
  127.             }
  128.             else
  129.             {
  130.                _loc8_ = Number(_loc5_.getExplicitOrMeasuredWidth());
  131.             }
  132.             if(_loc3_)
  133.             {
  134.                _loc6_ += _loc2_ + _loc8_;
  135.             }
  136.             else
  137.             {
  138.                _loc6_ = Math.max(_loc6_,_loc8_);
  139.             }
  140.             _loc7_++;
  141.          }
  142.          return _loc6_;
  143.       }
  144.       
  145.       override protected function clickHandler(param1:MouseEvent) : void
  146.       {
  147.          if(mx_internal::simulatedClickTriggerEvent == null)
  148.          {
  149.             mx_internal::focusedIndex = getChildIndex(DisplayObject(param1.currentTarget));
  150.             mx_internal::drawButtonFocus(mx_internal::focusedIndex,true);
  151.          }
  152.          super.clickHandler(param1);
  153.       }
  154.       
  155.       override protected function createNavItem(param1:String, param2:Class = null) : IFlexDisplayObject
  156.       {
  157.          var _loc8_:CSSStyleDeclaration = null;
  158.          var _loc9_:* = false;
  159.          var _loc10_:Button = null;
  160.          var _loc3_:Button = Button(mx_internal::navItemFactory.newInstance());
  161.          _loc3_.focusEnabled = false;
  162.          var _loc4_:String = getStyle(mx_internal::buttonStyleNameProp);
  163.          var _loc5_:String = getStyle(mx_internal::firstButtonStyleNameProp);
  164.          var _loc6_:String = getStyle(mx_internal::lastButtonStyleNameProp);
  165.          if(!_loc4_)
  166.          {
  167.             _loc4_ = "ButtonBarButton";
  168.          }
  169.          if(!_loc5_)
  170.          {
  171.             _loc5_ = _loc4_;
  172.          }
  173.          if(!_loc6_)
  174.          {
  175.             _loc6_ = _loc4_;
  176.          }
  177.          var _loc7_:int = numChildren;
  178.          if(_loc7_ == 0)
  179.          {
  180.             _loc3_.styleName = _loc4_;
  181.          }
  182.          else
  183.          {
  184.             _loc3_.styleName = _loc6_;
  185.             _loc8_ = StyleManager.getStyleDeclaration("." + _loc6_);
  186.             if((Boolean(_loc8_)) && !_loc8_.getStyle("focusRoundedCorners"))
  187.             {
  188.                _loc3_.setStyle("focusRoundedCorners","tr br");
  189.             }
  190.             _loc9_ = _loc7_ == 1;
  191.             _loc10_ = Button(getChildAt(_loc9_ ? 0 : _loc7_ - 1));
  192.             if(_loc9_)
  193.             {
  194.                _loc10_.styleName = _loc5_;
  195.                _loc8_ = StyleManager.getStyleDeclaration("." + _loc5_);
  196.                if((Boolean(_loc8_)) && !_loc8_.getStyle("focusRoundedCorners"))
  197.                {
  198.                   _loc10_.setStyle("focusRoundedCorners","tl bl");
  199.                }
  200.             }
  201.             else
  202.             {
  203.                _loc10_.styleName = _loc4_;
  204.                _loc8_ = StyleManager.getStyleDeclaration("." + _loc4_);
  205.                if((Boolean(_loc8_)) && !_loc8_.getStyle("focusRoundedCorners"))
  206.                {
  207.                   _loc10_.setStyle("focusRoundedCorners","");
  208.                }
  209.             }
  210.             _loc10_.mx_internal::changeSkins();
  211.             _loc10_.invalidateDisplayList();
  212.          }
  213.          _loc3_.label = param1;
  214.          _loc3_.setStyle("icon",param2);
  215.          _loc3_.addEventListener(MouseEvent.CLICK,clickHandler);
  216.          addChild(_loc3_);
  217.          recalcButtonWidths = recalcButtonHeights = true;
  218.          return _loc3_;
  219.       }
  220.       
  221.       override public function styleChanged(param1:String) : void
  222.       {
  223.          var _loc3_:String = null;
  224.          var _loc4_:String = null;
  225.          var _loc5_:String = null;
  226.          var _loc6_:String = null;
  227.          var _loc7_:int = 0;
  228.          var _loc8_:int = 0;
  229.          var _loc2_:Boolean = param1 == null || param1 == "styleName";
  230.          super.styleChanged(param1);
  231.          if(_loc2_ || param1 == mx_internal::buttonStyleNameProp || param1 == mx_internal::firstButtonStyleNameProp || param1 == mx_internal::lastButtonStyleNameProp)
  232.          {
  233.             _loc3_ = getStyle(mx_internal::buttonStyleNameProp);
  234.             _loc4_ = getStyle(mx_internal::firstButtonStyleNameProp);
  235.             _loc5_ = getStyle(mx_internal::lastButtonStyleNameProp);
  236.             if(!_loc3_)
  237.             {
  238.                _loc3_ = "ButtonBarButton";
  239.             }
  240.             if(!_loc4_)
  241.             {
  242.                _loc4_ = _loc3_;
  243.             }
  244.             if(!_loc5_)
  245.             {
  246.                _loc5_ = _loc3_;
  247.             }
  248.             _loc7_ = numChildren;
  249.             _loc8_ = 0;
  250.             while(_loc8_ < _loc7_)
  251.             {
  252.                if(_loc8_ == 0)
  253.                {
  254.                   _loc6_ = _loc4_;
  255.                }
  256.                else if(_loc8_ == _loc7_ - 1)
  257.                {
  258.                   _loc6_ = _loc5_;
  259.                }
  260.                else
  261.                {
  262.                   _loc6_ = _loc3_;
  263.                }
  264.                Button(getChildAt(_loc8_)).styleName = _loc6_;
  265.                _loc8_++;
  266.             }
  267.             recalcButtonWidths = recalcButtonHeights = true;
  268.          }
  269.          if(param1 == mx_internal::buttonWidthProp)
  270.          {
  271.             recalcButtonWidths = true;
  272.          }
  273.          else if(param1 == mx_internal::buttonHeightProp)
  274.          {
  275.             recalcButtonHeights = true;
  276.          }
  277.       }
  278.       
  279.       override protected function commitProperties() : void
  280.       {
  281.          var _loc1_:int = 0;
  282.          var _loc2_:int = 0;
  283.          super.commitProperties();
  284.          if(directionChanged)
  285.          {
  286.             directionChanged = false;
  287.             _loc1_ = numChildren;
  288.             _loc2_ = 0;
  289.             while(_loc2_ < _loc1_)
  290.             {
  291.                Button(getChildAt(_loc2_)).mx_internal::changeSkins();
  292.                _loc2_++;
  293.             }
  294.          }
  295.       }
  296.       
  297.       private function calcFullHeight() : Number
  298.       {
  299.          var _loc2_:Number = NaN;
  300.          var _loc6_:Number = NaN;
  301.          var _loc8_:Number = NaN;
  302.          var _loc1_:int = numChildren;
  303.          if(_loc1_ == 0)
  304.          {
  305.             return 0;
  306.          }
  307.          if(_loc1_ > 1)
  308.          {
  309.             _loc2_ = getStyle("verticalGap");
  310.          }
  311.          var _loc3_:* = direction == BoxDirection.VERTICAL;
  312.          var _loc4_:Number = getStyle(mx_internal::buttonHeightProp);
  313.          var _loc5_:IUIComponent = IUIComponent(getChildAt(0));
  314.          if(_loc4_)
  315.          {
  316.             _loc6_ = isNaN(_loc5_.explicitHeight) ? _loc4_ : Number(_loc5_.explicitHeight);
  317.          }
  318.          else
  319.          {
  320.             _loc6_ = Number(_loc5_.getExplicitOrMeasuredHeight());
  321.          }
  322.          var _loc7_:int = 1;
  323.          while(_loc7_ < _loc1_)
  324.          {
  325.             _loc5_ = IUIComponent(getChildAt(_loc7_));
  326.             if(_loc4_)
  327.             {
  328.                _loc8_ = isNaN(_loc5_.explicitHeight) ? _loc4_ : Number(_loc5_.explicitHeight);
  329.             }
  330.             else
  331.             {
  332.                _loc8_ = Number(_loc5_.getExplicitOrMeasuredHeight());
  333.             }
  334.             if(_loc3_)
  335.             {
  336.                _loc6_ += _loc2_ + _loc8_;
  337.             }
  338.             else
  339.             {
  340.                _loc6_ = Math.max(_loc6_,_loc8_);
  341.             }
  342.             _loc7_++;
  343.          }
  344.          return _loc6_;
  345.       }
  346.       
  347.       override protected function resetNavItems() : void
  348.       {
  349.          recalcButtonWidths = recalcButtonHeights = true;
  350.          invalidateDisplayList();
  351.       }
  352.       
  353.       override public function get viewMetrics() : EdgeMetrics
  354.       {
  355.          return EdgeMetrics.EMPTY;
  356.       }
  357.       
  358.       mx_internal function prevIndex(param1:int) : int
  359.       {
  360.          var _loc2_:int = numChildren;
  361.          return param1 == 0 ? _loc2_ - 1 : param1 - 1;
  362.       }
  363.       
  364.       private function scaleChangedHandler(param1:Event) : void
  365.       {
  366.          var _loc3_:Button = null;
  367.          var _loc2_:int = 0;
  368.          while(_loc2_ < numChildren)
  369.          {
  370.             _loc3_ = getChildAt(_loc2_) as Button;
  371.             if(_loc3_)
  372.             {
  373.                _loc3_.explicitWidth = NaN;
  374.                _loc3_.minWidth = NaN;
  375.                _loc3_.maxWidth = NaN;
  376.                _loc3_.explicitHeight = NaN;
  377.                _loc3_.minHeight = NaN;
  378.                _loc3_.maxHeight = NaN;
  379.             }
  380.             _loc2_++;
  381.          }
  382.       }
  383.       
  384.       mx_internal function drawButtonFocus(param1:int, param2:Boolean) : void
  385.       {
  386.          var _loc3_:Button = null;
  387.          if(numChildren > 0 && param1 < numChildren)
  388.          {
  389.             _loc3_ = Button(getChildAt(param1));
  390.             _loc3_.drawFocus(param2 && Boolean(focusManager.showFocusIndicator));
  391.             if(param2)
  392.             {
  393.                dispatchEvent(new Event("focusDraw"));
  394.             }
  395.             if(!param2 && _loc3_.mx_internal::phase != ButtonPhase.UP)
  396.             {
  397.                _loc3_.mx_internal::phase = ButtonPhase.UP;
  398.             }
  399.          }
  400.       }
  401.       
  402.       override protected function keyDownHandler(param1:KeyboardEvent) : void
  403.       {
  404.          var _loc2_:Button = null;
  405.          if(param1.eventPhase != EventPhase.AT_TARGET)
  406.          {
  407.             return;
  408.          }
  409.          switch(param1.keyCode)
  410.          {
  411.             case Keyboard.DOWN:
  412.             case Keyboard.RIGHT:
  413.                focusManager.showFocusIndicator = true;
  414.                mx_internal::drawButtonFocus(mx_internal::focusedIndex,false);
  415.                mx_internal::focusedIndex = mx_internal::nextIndex(mx_internal::focusedIndex);
  416.                if(mx_internal::focusedIndex != -1)
  417.                {
  418.                   mx_internal::drawButtonFocus(mx_internal::focusedIndex,true);
  419.                }
  420.                param1.stopPropagation();
  421.                break;
  422.             case Keyboard.UP:
  423.             case Keyboard.LEFT:
  424.                focusManager.showFocusIndicator = true;
  425.                mx_internal::drawButtonFocus(mx_internal::focusedIndex,false);
  426.                mx_internal::focusedIndex = mx_internal::prevIndex(mx_internal::focusedIndex);
  427.                if(mx_internal::focusedIndex != -1)
  428.                {
  429.                   mx_internal::drawButtonFocus(mx_internal::focusedIndex,true);
  430.                }
  431.                param1.stopPropagation();
  432.                break;
  433.             case Keyboard.SPACE:
  434.                if(mx_internal::focusedIndex != -1)
  435.                {
  436.                   _loc2_ = Button(getChildAt(mx_internal::focusedIndex));
  437.                   _loc2_.dispatchEvent(param1);
  438.                }
  439.                param1.stopPropagation();
  440.          }
  441.       }
  442.       
  443.       override protected function measure() : void
  444.       {
  445.          var _loc1_:EdgeMetrics = null;
  446.          super.measure();
  447.          _loc1_ = viewMetricsAndPadding;
  448.          measuredWidth = calcFullWidth() + _loc1_.left + _loc1_.right;
  449.          measuredHeight = calcFullHeight() + _loc1_.top + _loc1_.bottom;
  450.          if(getStyle(mx_internal::buttonWidthProp))
  451.          {
  452.             measuredMinWidth = measuredWidth;
  453.          }
  454.          if(getStyle(mx_internal::buttonHeightProp))
  455.          {
  456.             measuredMinHeight = measuredHeight;
  457.          }
  458.       }
  459.       
  460.       private function childRemoveHandler(param1:ChildExistenceChangedEvent) : void
  461.       {
  462.          var _loc8_:Button = null;
  463.          var _loc2_:DisplayObject = param1.relatedObject;
  464.          var _loc3_:int = getChildIndex(_loc2_);
  465.          var _loc4_:int = numChildren;
  466.          if(_loc4_ < 2)
  467.          {
  468.             return;
  469.          }
  470.          var _loc5_:String = getStyle(mx_internal::buttonStyleNameProp);
  471.          var _loc6_:String = getStyle(mx_internal::firstButtonStyleNameProp);
  472.          var _loc7_:String = getStyle(mx_internal::lastButtonStyleNameProp);
  473.          if(!_loc5_)
  474.          {
  475.             _loc5_ = "buttonBarButtonStyle";
  476.          }
  477.          if(!_loc6_)
  478.          {
  479.             _loc6_ = _loc5_;
  480.          }
  481.          if(!_loc7_)
  482.          {
  483.             _loc7_ = _loc5_;
  484.          }
  485.          if(_loc3_ == 0 || _loc3_ == _loc4_ - 1)
  486.          {
  487.             _loc8_ = Button(getChildAt(_loc3_ == _loc4_ - 1 ? _loc4_ - 2 : 0));
  488.             _loc8_.styleName = _loc3_ == 0 ? _loc6_ : _loc7_;
  489.             _loc8_.mx_internal::changeSkins();
  490.             _loc8_.invalidateDisplayList();
  491.          }
  492.       }
  493.       
  494.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  495.       {
  496.          var _loc3_:* = false;
  497.          var _loc16_:int = 0;
  498.          var _loc17_:Button = null;
  499.          var _loc18_:Number = NaN;
  500.          var _loc19_:int = 0;
  501.          var _loc20_:int = 0;
  502.          var _loc21_:Number = NaN;
  503.          var _loc22_:int = 0;
  504.          var _loc23_:int = 0;
  505.          var _loc24_:int = 0;
  506.          var _loc25_:Number = NaN;
  507.          _loc3_ = direction == BoxDirection.HORIZONTAL;
  508.          var _loc4_:* = !_loc3_;
  509.          var _loc5_:Number = getStyle(mx_internal::buttonWidthProp);
  510.          var _loc6_:Number;
  511.          var _loc7_:Number = _loc6_ = getStyle(mx_internal::buttonHeightProp);
  512.          var _loc8_:EdgeMetrics = viewMetricsAndPadding;
  513.          var _loc9_:int = numChildren;
  514.          var _loc10_:Number = getStyle("horizontalGap");
  515.          var _loc11_:Number = getStyle("verticalGap");
  516.          var _loc12_:Number = _loc3_ && numChildren > 0 ? _loc10_ * (_loc9_ - 1) : 0;
  517.          var _loc13_:Number = _loc4_ && numChildren > 0 ? _loc11_ * (_loc9_ - 1) : 0;
  518.          var _loc14_:Number = param1 - _loc8_.left - _loc8_.right - _loc12_;
  519.          var _loc15_:Number = param2 - _loc8_.top - _loc8_.bottom - _loc13_;
  520.          if(!_loc14_ || !_loc15_)
  521.          {
  522.             return;
  523.          }
  524.          if(mx_internal::border)
  525.          {
  526.             mx_internal::border.visible = false;
  527.          }
  528.          if(param1 != oldUnscaledWidth)
  529.          {
  530.             recalcButtonWidths = true;
  531.             oldUnscaledWidth = param1;
  532.          }
  533.          if(param2 != oldUnscaledHeight)
  534.          {
  535.             recalcButtonHeights = true;
  536.             oldUnscaledHeight = param2;
  537.          }
  538.          if(recalcButtonWidths)
  539.          {
  540.             recalcButtonWidths = false;
  541.             if(isNaN(_loc5_) && _loc4_)
  542.             {
  543.                _loc5_ = _loc14_;
  544.             }
  545.             _loc18_ = _loc14_ - (calcFullWidth() - _loc12_);
  546.             _loc19_ = _loc9_ > 0 ? int(_loc14_ / _loc9_) : 0;
  547.             _loc20_ = 0;
  548.             _loc21_ = 0;
  549.             _loc22_ = 0;
  550.             if(_loc18_ != 0 && _loc3_)
  551.             {
  552.                _loc16_ = 0;
  553.                while(_loc16_ < _loc9_)
  554.                {
  555.                   _loc17_ = Button(getChildAt(_loc16_));
  556.                   if(isNaN(_loc17_.explicitWidth))
  557.                   {
  558.                      _loc23_ = _loc17_.measuredWidth;
  559.                      _loc21_ += _loc23_;
  560.                      if(_loc23_ > _loc19_)
  561.                      {
  562.                         _loc20_++;
  563.                      }
  564.                      else
  565.                      {
  566.                         _loc22_ += _loc23_;
  567.                      }
  568.                   }
  569.                   _loc16_++;
  570.                }
  571.             }
  572.             else
  573.             {
  574.                _loc21_ = _loc14_;
  575.             }
  576.             _loc16_ = 0;
  577.             while(_loc16_ < _loc9_)
  578.             {
  579.                _loc17_ = Button(getChildAt(_loc16_));
  580.                if(isNaN(_loc17_.explicitWidth))
  581.                {
  582.                   _loc17_.minWidth = 0;
  583.                   if(!isNaN(_loc5_))
  584.                   {
  585.                      _loc17_.minWidth = _loc17_.maxWidth = _loc5_;
  586.                      _loc17_.percentWidth = _loc5_ / Math.min(_loc14_,_loc21_) * 100;
  587.                   }
  588.                   else if(_loc18_ < 0)
  589.                   {
  590.                      _loc24_ = _loc17_.measuredWidth;
  591.                      if(_loc24_ > _loc19_)
  592.                      {
  593.                         _loc24_ = (_loc14_ - _loc22_) / _loc20_;
  594.                      }
  595.                      _loc17_.percentWidth = Number(_loc24_) / _loc14_ * 100;
  596.                   }
  597.                   else if(_loc18_ > 0)
  598.                   {
  599.                      _loc17_.percentWidth = _loc17_.measuredWidth / _loc21_ * 100;
  600.                   }
  601.                   else
  602.                   {
  603.                      _loc17_.percentWidth = NaN;
  604.                   }
  605.                   if(_loc4_)
  606.                   {
  607.                      _loc17_.percentWidth = 100;
  608.                   }
  609.                }
  610.                _loc16_++;
  611.             }
  612.          }
  613.          if(recalcButtonHeights)
  614.          {
  615.             recalcButtonHeights = false;
  616.             if(isNaN(_loc7_) && _loc3_)
  617.             {
  618.                _loc7_ = _loc15_;
  619.             }
  620.             _loc18_ = _loc15_ - (calcFullHeight() - _loc13_);
  621.             _loc25_ = 0;
  622.             if(_loc18_ != 0 && _loc4_)
  623.             {
  624.                _loc16_ = 0;
  625.                while(_loc16_ < _loc9_)
  626.                {
  627.                   _loc17_ = Button(getChildAt(_loc16_));
  628.                   if(isNaN(_loc17_.explicitHeight))
  629.                   {
  630.                      _loc25_ += _loc17_.measuredHeight;
  631.                   }
  632.                   _loc16_++;
  633.                }
  634.             }
  635.             _loc16_ = 0;
  636.             while(_loc16_ < _loc9_)
  637.             {
  638.                _loc17_ = Button(getChildAt(_loc16_));
  639.                if(isNaN(_loc17_.explicitHeight))
  640.                {
  641.                   _loc17_.minHeight = 0;
  642.                   if(!isNaN(_loc7_))
  643.                   {
  644.                      _loc17_.minHeight = _loc7_;
  645.                      _loc17_.percentHeight = _loc7_ / Math.min(_loc25_,_loc15_) * 100;
  646.                   }
  647.                   if(!isNaN(_loc6_))
  648.                   {
  649.                      _loc17_.maxHeight = _loc6_;
  650.                   }
  651.                   if(_loc3_)
  652.                   {
  653.                      _loc17_.percentHeight = 100;
  654.                   }
  655.                   else if(_loc18_ < 0)
  656.                   {
  657.                      _loc17_.percentHeight = _loc17_.measuredHeight / _loc25_ * 100;
  658.                   }
  659.                   else if(_loc18_ > 0)
  660.                   {
  661.                      _loc17_.percentHeight = _loc17_.measuredHeight / _loc25_ * 100;
  662.                   }
  663.                   else
  664.                   {
  665.                      _loc17_.percentHeight = NaN;
  666.                   }
  667.                }
  668.                _loc16_++;
  669.             }
  670.          }
  671.          super.updateDisplayList(param1,param2);
  672.       }
  673.       
  674.       override public function drawFocus(param1:Boolean) : void
  675.       {
  676.          mx_internal::drawButtonFocus(mx_internal::focusedIndex,param1);
  677.       }
  678.       
  679.       [Bindable("directionChanged")]
  680.       override public function set direction(param1:String) : void
  681.       {
  682.          if(initialized && param1 != direction)
  683.          {
  684.             directionChanged = true;
  685.             invalidateProperties();
  686.          }
  687.          super.direction = param1;
  688.       }
  689.    }
  690. }
  691.  
  692.